package ex.datastream.connectors;

import ex.datastream.ApiFrame;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.util.NumberSequenceIterator;


/**
 * 示例：基于集合读取数据源
 * https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/datastream/overview/
 */
public class CollectionTest03 extends ApiFrame {
    public static void main(String[] args) throws Exception {
        final StreamExecutionEnvironment env =
                StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<Long> dataStream1 = env.fromParallelCollection(new NumberSequenceIterator(1L, 6L), Long.class);

        System.out.println("fromParallelCollection创建的DataStream并行度为：" + dataStream1.getParallelism());

        dataStream1.print();

        env.execute();

    }
}
